home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip: 2005 Utilities
/
CHIP Utilities 2005.7z
/
CHIP Utilities 2005.iso
/
images
/
arachne.igz
/
arachne.img
/
LEVEL1
/
KEYBRD.CAB
/
Bin
/
Keybrd.bat
< prev
Wrap
DOS Batch File
|
2005-01-16
|
5KB
|
179 lines
@if "%debug%"=="" echo off
if "%1"==":" if not "%2"=="" goto %2
:: keybrd Begin ::
if not exist %ramdrv%\bin\lmod.com %0 : _error missing lmod.com (check utils.%arcext%)
if not exist %ramdrv%\bin\wbat.com %0 : _error missing wbat.com (check utils.%arcext%)
if not exist %ramdrv%\bin\keyb.exe %0 : _error missing keyb.exe
:_start
echo. >%tmp%\_keybrd.tmp
if not exist %ramdrv%\etc\global.set goto _noglob
type %ramdrv%\etc\global.set >%tmp%\_keybrd.tmp
:_noglob
if not exist %ramdrv%\etc\keybrd.set goto _nospec
type %ramdrv%\etc\keybrd.set >%tmp%\_keybrd.tmp
:_nospec
xgrep -sy "^[:s]*@*[:s]*s?e?t?[:s]*keyb_.+=" %tmp%\_keybrd.tmp >%tmp%\_keybrd.bak
if errorlevel 1 goto _noset
xgrep -sy "^[:s]*@*[:s]*set[:s]+" %tmp%\_keybrd.bak >%tmp%\_keybrd.bat
xgrep -syv "^[:s]*@*[:s]*set[:s]+" %tmp%\_keybrd.bak >%tmp%\_keybrd.tmp
if errorlevel 1 goto _runset
lmod /L* set []<%tmp%\_keybrd.tmp >>%tmp%\_keybrd.bat
:_runset
call %tmp%\_keybrd.bat
:_noset
if "%keyb_ti%"=="" set keyb_ti=5
for %%i in (-u -U) do if "%1"=="%%i" goto _unload
if "%1"=="/u" goto _unload
if "%1"=="/U" goto _unload
for %%i in (-c -C) do if "%1"=="%%i" goto _config
if "%1"=="/c" goto _config
if "%1"=="/C" goto _config
for %%i in (-h -H -?) do if "%1"=="%%i" goto _usage
if "%1"=="/h" goto _usage
if "%1"=="/H" goto _usage
if "%1"=="/?" goto _usage
if "%keyb_ncfg%"=="1" goto _nocfg
set wcb1=%keyb_install%
call w.bat box @%0:w_cfg #2,%keyb_ti%
if errorlevel 3 goto _end
set keyb_install=%wcb1%
if errorlevel 2 goto _config
:_nocfg
:_install
if not "%keyb_install%"=="1" goto _skipkeyb
%ramdrv%\bin\keyb.exe /L >%tmp%\_keybrd.bat
lmod /L2* /S- [$1] [-]<%tmp%\_keybrd.bat >%tmp%\_keybrd.tmp
echo @if "%%debug%%"=="" echo off >%tmp%\_keybrd.bat
lmod for %%%%i in ([]) do if "%%1"=="%%%%i" goto _end<%tmp%\_keybrd.tmp >>%tmp%\_keybrd.bat
echo %%ramdrv%%\bin\el!.com 1>>%tmp%\_keybrd.bat
echo :_end>>%tmp%\_keybrd.bat
call %tmp%\_keybrd.bat %keyb_kc%
if errorlevel 1 set keyb_kc=
if "%keyb_kc%"=="" set keyb_kc=US
echo KEYBRD: Loading keyboard driver (%keyb_kc%).
%ramdrv%\bin\keyb.exe %keyb_kc% %1 %2 %3 %4 %5 %6 %7 %8
if errorlevel 1 %0 : _error keyb installation failed
goto _end
:_skipkeyb
echo KEYBRD: Skip loading Keyboard driver
goto _end
:_unload
echo KEYBRD: Unloading Keyboard driver
%ramdrv%\bin\keyb.exe /U
goto _end
:_config
%ramdrv%\bin\keyb.exe /U >%tmp%\nul
%ramdrv%\bin\keyb.exe /L | lmod /L* /B'' [$1][$2][$3][$4]>%tmp%\_keybrd.tmp
echo :w_list " Select keyboard code [x] " >%tmp%\_keybrd.bak
echo US UNITED STATES standard keyboard (437)>>%tmp%\_keybrd.bak
lmod /L2* /S- [$1] [$2:!]<%tmp%\_keybrd.tmp >>%tmp%\_keybrd.bak
echo :: >>%tmp%\_keybrd.bak
call w.bat list @%tmp%\_keybrd.bak:w_list
if errorlevel 100 goto _default
echo set keyb_kc=>%tmp%\_keybrd.bat
echo %wbat% >%tmp%\_keybrd.tmp
lmod set keyb_kc=[$1]<%tmp%\_keybrd.tmp >>%tmp%\_keybrd.bat
call %tmp%\_keybrd.bat
:_default
if "%keyb_kc%"=="" set keyb_kc=US
echo :w_config "keybrd configuration" [x]>%tmp%\_keybrd.tmp
echo.>>%tmp%\_keybrd.tmp
echo Dialog timeout [$ keyb_ti,3] seconds.>>%tmp%\_keybrd.tmp
echo.>>%tmp%\_keybrd.tmp
echo [!] Skip "Run keybrd or go config?" dialog>>%tmp%\_keybrd.tmp
echo.>>%tmp%\_keybrd.tmp
echo [!] Install KEYB %keyb_kc% >>%tmp%\_keybrd.tmp
echo.>>%tmp%\_keybrd.tmp
echo [ Save ] [? Cancel ]>>%tmp%\_keybrd.tmp
set wcb1=%keyb_ncfg%
set wcb2=%keyb_install%
call w.bat box @%tmp%\_keybrd.tmp:w_config
if errorlevel 2 goto _end
set keyb_ncfg=%wcb1%
set keyb_install=%wcb2%
set t_out=1
call drd.bat %srcdrv%
if errorlevel 1 set t_out=0
wbat box @%0:w_wprot #1,%t_out%
set t_out=
if errorlevel 2 goto _start
echo KEYBRD: Saving configuration...
set | tfind /f1,5 "keyb_">%tmp%\_keybrd.bat
if not exist %srcdrv%\etc\*.* mkdir %srcdrv%\etc
if not exist %ramdrv%\etc\global.set goto _yglob
xgrep -syv "^[:s]*@*[:s]*s?e?t?[:s]*keyb_.+=" %ramdrv%\etc\global.set >>%tmp%\_keybrd.bat
:_yglob
type %tmp%\_keybrd.bat >%srcdrv%\etc\global.set
type %tmp%\_keybrd.bat >%ramdrv%\etc\global.set
if exist %srcdrv%\etc\keybrd.set del %srcdrv%\etc\keybrd.set >%tmp%\nul
if exist %ramdrv%\etc\keybrd.set del %ramdrv%\etc\keybrd.set >%tmp%\nul
echo KEYBRD: Configuration saved to %srcdrv%\etc\global.set
echo.
goto _start
:w_cfg " Run keybrd or go config? " [x]
(~press any key~: #? sec.)
[!] Installing keyboard (%keyb_kc%) ...
[ Ok ] [ Config ] [? Abort ]
::
:w_wprot "Disable write protection..." [x]
If the disk in drive %srcdrv% is write
protected, please disable the write
protection now in order to save settings.
You can re-enable write protection after
saving.
[ Ok ] [? Cancel ]
::
:_usage
echo Parameters:
echo -c Config mode
echo -u Unload
echo -h This help info
echo.
goto _end
:_error
shift
shift
echo.
echo KEYBRD (error) %1 %2 %3 %4 %5 %6 %7 %8
echo.
@rem pause
goto _end
:_abort
echo KEYBRD: Aborted...
echo.
@rem pause
:_end
set | tfind /f1,2 "W_" >%tmp%\_keybrd.tmp
set | tfind /f1,5 "keyb_" >>%tmp%\_keybrd.tmp
type %tmp%\_keybrd.tmp | lmod /L* /B= set [$1]=>%tmp%\_keybrd.bat
call %tmp%\_keybrd.bat
for %%i in (%tmp%\_keybrd.*) do if exist %%i del %%i >%tmp%\nul
set ?=
set wcb1=
set wcb2=
set wcb3=
set wcb4=
set wcb5=
set wcb6=
set wcb7=
set wcb8=
set wcb9=
set wrb=
set wbat=
:: keybrd End ::